home *** CD-ROM | disk | FTP | other *** search
- Zprofiler : a tool for optimizing Delphi programs on Pentium computers. version 1.10
- -------------------------------------------------------------------------------------
- This utility component enables the assessment of execution times of code fragments with a 0.01 microsecond
- resolution. It is based on the cpu clock of Pentium computers.
-
- Running the demo
- The demo does not require installation of the component ! In de Delphi IDE : open demo.dpr and run it.
-
- Installing the component :
- Put the files z_prof.pas , z_prof.dfm and z_prof.dcr in one of your library directories, and install z_prof as usual.
- The component Zprofiler will appear on the samples page of the palette.
-
- Usage :
- Using the component is extremely simple. Drop zprofiler on your form, and a modeless window will appear
- with a grid containing the timing results (during runtime).
- There is only one method you need to use for marking enclosed timing blocks :
- profile.mark(nr:integer; aactive:boolean);
- nr : number of the code fragment , currently maximal 20 blocks
- aactive : start/ stop marking a code fragment
- (NB prefereably, use the global profile pointer instead of zprofiler1 generated by Delphi)
- If you want to put markers in project units that have no form file, add the z_prof unit in its uses section,
- and instanciate the component dynamically if that has not yet been done elsewhere yet.
- The demo applies dynamic instantiation.
-
- Example :
- profile.mark(1,true); start timing fragment 1
- <some code > the program code under investigation
- profile.mark(1,false); stop timing fragment 1
-
- Running the demo
-
-
- Details :
- The markers act globally and are all owned by the mainform, accessible via the pointer "profile". Only one
- instance will be executed. Thus, there is no point to dropping more than one zprofiler on a form (no harm
- either). You can drop them on secondary forms as an easy way of updating the uses section with z_prof.
- When you need more markers than the standard 20, increase the nmarks constant in z_prof.pas and recompile.
- The codemarkers act independently from each other.
- The component is already active in designmode from the moment it is "dropped" (the result grid remains
- hidden though). Thus you could time design operations as well.
- If you prefer to instantiate the component dynamically, put z_prof in "uses" and make the call :
- tzprofiler.create(application.mainform); {note that there is no reason for storing the resulting pointer}
-
-
- Technical information :
- The resolution of 0.01 microseconds is not completely realistic. The component corrects for its own overhead
- as good as possible but I experience on my computer (133MHz Pentium) a reproducible residual 0.4 microseconds
- that I ascribe to the calling and return time of mark() method. Furthermore, there are occasional time lapses
- that are probably due to tasks in the operating system, or caused by cpu (cache) operations.
- If you want to time a very short interval, the column that displays the fastest time is probably the most "clean".
- However, the mean execution time is a better estimator of practical purposes.
- NB it only works on Pentiums ! , don't forget to remove the component after developementphase is finished !
-
- References
- Steve Durham, C/C++ user journal 'A Testjig Tool for Pentium Optimization' (Dec 1996).
- Massimo , uPentium freeware component, downloaded from Delphi Super Page (June 1997)
-
- History
- Changes from version 1.00 : an error in the overhead time correction for the "fastest" collumn has been fixed,
- this text document has been updated and the demo was added.
-
- Copyright
- Use it as you like. Feel free to adapt it to your needs, but if you publish it, please make proper references.
- If you have suggestions or improvements, send me an email :
- d950021@icpc00.icpc.fukui-u.ac.jp
- Antonie Baars, July 3, 1997